Give your agent the 200 tokens it needs about your codebase, not 8,000 tokens of noise.
Solve Track 02 · Context. Agent-Context walks any project, builds a dependency graph, and answers: if you touch this file, what else breaks? It outputs a compact context string that fits in a prompt. Extracted from 18 months of production Agentic OS.
When an AI agent is asked to edit a codebase, it has two bad choices: ingest the entire repository (which wastes thousands of tokens, causes distraction, and leads to context truncation) or guess (which leads to broken dependencies and silent failures). Codebases are structured graphs, but LLMs view them as flat text.
If an agent modifies src/auth.js, it doesn't just need to know the contents of that file. It needs to know which files rely on it (its dependents) so it doesn't break their API contracts, and which files it imports (its dependencies) so it understands its helper functions. Agent-Context extracts exactly this structural blast radius, condensing it into a tiny context snippet (~200 tokens) that is prepended to the system prompt.
node_modules, .git, dist, and venv to keep execution under 100ms.
import syntax, CommonJS require(), Python import/from, and Go imports. It resolves relative file paths into absolute workspace coordinates.
### GRAPHIFY STRUCTURAL CONTEXT FOR [src/auth.js] - Dependencies (what this file uses): src/db.js, src/utils/crypto.js - Dependents (what relies on this file): src/routes/login.js, src/routes/signup.js, src/middleware/guard.js Rule: If you modify this file, be aware of the blast radius affecting its dependents. ### END GRAPHIFY CONTEXT
The parser has zero native compiler dependencies and extracts import chains fast:
| Language | Parsed Syntaxes | Mechanism |
|---|---|---|
| JavaScript / TS | require(), import, export ... from |
Regex scanner + lexical token loop |
| Python | import x, from y import z |
Fast line parser skipping docstrings |
| Go | import ( ... ), import "..." |
Block tokenizer |
git clone https://github.com/shubham0086/Agent-Context cd Agent-Context npm install # Run graph discovery demo node demo/graph.js . # Query the blast radius for Graphify.js node demo/blast-radius.js src/Graphify.js .
import { GraphifyClient } from 'agent-context';
// 1. Initialize client pointing to project root
const client = new GraphifyClient('./my-project');
// 2. Discover files and parse imports
await client.buildGraph();
// 3. Get in-memory graph details
const summary = client.getGraphSummary();
console.log(`Discovered ${summary.nodeCount} files`);
// 4. Query neighborhood (dependents & dependencies)
const neighbors = client.queryNeighbors('src/auth.js');
// 5. Generate formatted prompt block
const promptSnippet = client.getContextString('src/auth.js');
In production environments, Large Language Models (LLMs) execute filesystem tools via the Model Context Protocol (MCP). However, exposing file paths blindly exposes host filesystems to path traversal exploits (e.g., CVE-2025-53110) or symlink bypasses (e.g., CVE-2025-53109).
Agent-Context mitigates these vulnerabilities by validating paths during graph tree queries. Every target file and discovered dependency path is normalized using native absolute path resolution, then verified against an allowlisted workspace root sandbox. Any file paths trying to escape the root workspace context are blocked before the dependency graph is updated.
Agent-Context solves the context boundary step of the autonomy ladder. It implements Pattern 04 (GraphDB for Agent Context) in Agentic Patterns. The core orchestration layer AgentKernel uses this client before launching coder subagents to target code changes without bloating the system prompt.
This uses token scanning rather than full AST generation or TS compiler services. This makes it extremely fast (runs in milliseconds) and allows it to process multiple languages with zero dependencies. However, it does not trace dynamic runtime imports or complex alias paths (like TSConfig paths) unless they are explicitly mapped in the workspace configuration. For 95% of standard code structure operations, the static token scan is perfectly sufficient.